//
//  HttpRequestManager.h
//  much
//
//  Created by weijunjie on 2019/1/2.
//  Copyright © 2019年 iOS. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ImageModel.h"

typedef NS_ENUM(NSInteger, UploadImageType) {
    UploadImageTypeOther = 0,//其它
    UploadImageTypeUserAvatar,//用户头像
    UploadImageTypeIdCard,//个人身份证
    UploadImageTypeSalesReturn,//退货认证
    UploadImageTypeCompanyLicense,//营业执照
    UploadImageTypeCompanyLogo,//公司Logo
    UploadImageTypeCategoryLogo,//品类Logo
    UploadImageTypeBrandLogo,//品牌Logo
    UploadImageTypeProduct,//商品
    UploadImageTypeBanner,//导航Banner
    UploadImageTypeArticleCover,//文章封面图
    UploadImageTypeArticleContent,//文章内容图
    UploadImageTypeCommentMerchandise, //评价商品图
};

typedef NS_ENUM(NSUInteger, ResultCodeType) {
    ResultCodeTypeSuccess = 0, // 成功
    ResultCodeTypeTokenFailure = 98030, // token失效
};

/** 请求成功的Block */
typedef void(^RequestSuccess)(_Nonnull id responseObject);

/** 请求失败的Block */
typedef void(^RequestFailed)(NSString *error);
/** 请求成功数据以及列表总页数 */
typedef void(^RequestSuccessAndTotalPage)(_Nonnull id responseObject,NSInteger totalPage);

typedef NS_ENUM(NSUInteger, HttpRequestMethodEnum) {
    HttpRequestPost,
    HttpRequestGet,
    HttpRequestPut,
    HttpRequestDelete,
};

NS_ASSUME_NONNULL_BEGIN

@interface MuchHttpRequestManager : NSObject

/**
 请求格式

 @param api 请求地址
 @param method get/post/put 请求方式
 @param arguments 参数
 @param success 成功的回调
 @param fail 失败的回调
 */
+ (void)sendHttpRequestWithAPI:(NSString *)api method:(HttpRequestMethodEnum)method arguments:(nullable  id)arguments andSuccessCallback:(RequestSuccess)success andFailCallback:(RequestFailed)fail;


/**
 上传图片

 @param uploadImageType 图片类型
 @param imageKey 后缀
 @param imageData 图片流
 */
+ (void)uploadImageRequestWithAPI:(UploadImageType)uploadImageType imageKey:(NSString *)imageKey imageData:(NSData *)imageData success:(RequestSuccess)success failure:(RequestFailed)failure;

@end

NS_ASSUME_NONNULL_END
